//
//  AYSHomeSearchBarTableVC.m
//  AiYingShiProject
//
//  Created by lanou on 15/10/28.
//  Copyright (c) 2015年 李晓理. All rights reserved.
//

#import "AYSHomeSearchBarTableVC.h"
#import "AYSHomeSearchBarModel.h"
#import "AYSHomeSDViewController.h"

@interface AYSHomeSearchBarTableVC ()

@end

@implementation AYSHomeSearchBarTableVC

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.view.frame = CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT - 64);
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"reuse"];
    self.navigationController.navigationBar.hidden = YES;
}



- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _searchArr.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"reuse" forIndexPath:indexPath];
    AYSHomeSearchBarModel *model = _searchArr[indexPath.row];
    cell.textLabel.text = model.q;
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    AYSHomeSDViewController *searchDetialVC = [[AYSHomeSDViewController alloc] init];
    // 传值
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    searchDetialVC.tableViewText = cell.textLabel.text;
    searchDetialVC.navigationController = self.navigationController;
    [self.navigationController pushViewController:searchDetialVC animated:YES];
}

@end
